package com.arron.jvm;

/**
 * @Classname StringTest
 * @Description TODO
 * @Date 2020/8/18 20:19
 * @Created by 刘
 */
public class StringTest {

    /**
     * 字符串常量池
     * @param args
     */
    public static void main(String[] args) {

        String s0 = "a";
        String s1 = "b";
        String s11="ab";
        String s2 = new String("ab");
        String s3 = new String("ab");
        String s4=new String("a");
        String s5=new String("b");
        System.out.println((s11==(s0+s1)));
        System.out.println((s11==("a"+"b")));
        System.out.println(s11==(s0+"b"));
        System.out.println(s11==s2);
        System.out.println(s2==s3);
        System.out.println(s11==s2.intern());
        System.out.println(s11==(s4+s5));
    }

}
